
dy-lib=libmydy.so
sta-lib=libmysta.a

.PHONY:all
all:$(dy-lib) $(sta-lib)

$(dy-lib):myobj.o test.o
	gcc -shared -o $@ $^
$(sta-lib):my.o
	ar -rc $@ $^
my.o:my.c
	gcc -c $^

myobj.o:myobj.c 
	gcc -fPIC -c $^
test.o:test.c
	gcc -fPIC -c $^

.PHONY:clean
clean:
	rm -rf *.o *.so *.a

.PHONY:output
output:
	mkdir -p mylib/include
	mkdir -p mylib/lib
	cp *.h mylib/include
	cp *.a mylib/lib
	cp *.so mylib/lib

